﻿using DataSyncCommon;
using DataSyncCommon.Model;
using Newtonsoft.Json;
using Quartz;
using Quartz.Logging;
using SupDataSync.Model;
using System;
using System.Threading.Tasks;

namespace ConsoleSub
{
    public class MonitorJob : IJob
    {
        public Task Execute(IJobExecutionContext context)
        {
            var url = SysConfig.url;
            var log = new ba_sup_logmonitor()
            {
                TenantId = SysConfig.TenantId
            };
            var responseStr = HttpHelper.WebRequestApi(url + "/MonitorLog", JsonConvert.SerializeObject(log), "POST");
            var syncResultList = JsonConvert.DeserializeObject<int>(responseStr);
            LogHelper.CreateLoger().Error($"执行监听任务数据上传交互{syncResultList},,{DateTime.Now.ToString()}");
            Console.WriteLine(syncResultList+DateTime.Now.ToString());
            return SysConfig.CompletedTask;
        }
    }
}
